listView in Dialog Box blank

Hi,

This is my first real attempt at a Dialog Box and I'm stuck with a blank listView that I want to produce a multi-select checkbox list.

We have an XML document with all the links between DOORS and another system, the software that dumps the information does it for every object in each DOORS module but I'd only like to identify certain objects based on their "Object Type" attribute, if it exists and furthermore on certain types e.g. Requirements, Use Cases, etc. which are contained as enumerated values. These objects I will then be creating external links to the other system.

On line 126 of my code below I think I may be doing something wrong as this is where I'm attempting to create my listView but it keeps coming up with a blank white box. Can anyone tell me what I'm doing wrong please?

DB dbChooseAttribute
DBE dbeAddAttributeChoice
DBE dbeAddTypeChoice
DBE dbeOKAttribute //OK button


Module m = current

string sObjectType = ""
string sEnumeratedType = ""

int iAttributeCount = 0
int ienumCount = 0

bool bPrintComma = false

AttrDef ad




// This is to find out how many Object Attributes there are to create the correct sized array
for ad in m do //loop through attributes in the module
{    if(ad.object == true) // only identify Object Attributes e.g. excludes Module Attributes
        {
                iAttributeCount ++ //count the number of object attributes to build the array size
        }//end if
} //end for loop
print "Object Attribute Count (not including Module Attributes) = " iAttributeCount"\n"


// This is to create the array and loop through each Object Attribute, get it's name and add it to the array
string arrayAttrDefChoices[iAttributeCount] //create the array
int indexAttrDef = 0
        //for (indexAttrDef = 0; indexAttrDef < iAttributeCount; indexAttrDef++) //loop through each Attribute
for ad in m do
{     if(ad.object == true)
        {
        arrayAttrDefChoices[indexAttrDef] = ad.name //get the name of each Attribute
print indexAttrDef" - "ad.name"\n" 
                if(matches("Object Type",ad.name))
                {
                        //iDefaultAttrChoice = indexAttrDef
                        sObjectType = ad.name""
                        
                }// end if
        indexAttrDef ++
        }// end if
} // end for loop

void doTargetOK(DB dbChooseAttribute) 
{
        int i=get(dbeAddAttributeChoice)
        sObjectType=arrayAttrDefChoices[i]
}

if(sObjectType != "")//if an attribute called "Object Type" exists use it instead of asking the user to choose.
{
        ad = find(m,sObjectType)//set the Attribute to "Object Type"
}
else
{

        dbChooseAttribute = create("Choose Attribute to Filter which objects will have links",styleFloating)
        dbeAddAttributeChoice = choice(dbChooseAttribute,"Which Attribute do you want to filter by? ",arrayAttrDefChoices,0)
        dbeOKAttribute = ok(dbChooseAttribute,"OK",doTargetOK)
        block dbChooseAttribute //this shows the dialog box then continues with the dxl

}


ad = find(m,sObjectType"")//set the Attribute to "Object Type"
AttrType at = ad.type //find what Attribute Type the Attribute Definition uses
AttrBaseType abt = at.type //Find out what the Attribute Base Type is e.g. Enumeration
string sabt = stringOf(abt) //make the Attribute Base Type name printable

ienumCount = at.size //how many selections are in the attr type
print sabt" Count= " ienumCount"\n" 
string arrayAttrTypeChoices[ienumCount] //create the array
int indexEnum 
    for (indexEnum = 0; indexEnum < ienumCount; indexEnum++) //loop through each number in the enumerators
    { 
        arrayAttrTypeChoices[indexEnum] = at.strings[indexEnum] //get the name of each enumerator

print indexEnum" - "at.strings[indexEnum]"\n" 
                if(matches("^Requirement|User Story|Non Functional Requirement|Business Requirement|Theme|System Requirement|Use Case|Interface|Step",at.strings[indexEnum])) //Identify all common types for linking automatically
                {
                        if(bPrintComma){sEnumeratedType = sEnumeratedType "s, " at.strings[indexEnum]}
                        else{sEnumeratedType = at.strings[indexEnum]
                        bPrintComma = true}
                        
                }// end if
    } // end for loop

DB dbChooseEnumeratedType = null
DBE dbeAddEnumeratedChoice = null
DBE dbeOKEnumerated //OK button


void doEnumerateOK(DB dbChooseEnumeratedType) //Build a list of the checked values to create links on these objects
{
print "Type/s manually chosen by user "
    int i
       for(i = 0; sizeof(arrayAttrTypeChoices) > i; i++)
        {
                if (getCheck(dbeAddEnumeratedChoice,i) ) {
                        sEnumeratedType = getColumnValue(dbeAddEnumeratedChoice,i,0)
                        if (i != 0) print ", "
                         print sEnumeratedType 
                }
        }
        print "\n"
 
}


/*if(sEnumeratedType != "")//if a selection in the Enumerated values matches a common type, use it instead of asking the user to choose. //deactivated this section to work on checkbox selection below
{
        ad = find(m,sEnumeratedType)//set the Attribute to common type
}
else
{
*/

        dbChooseEnumeratedType = create("Choose Type to Filter which objects will have links")
        dbeAddEnumeratedChoice = listView(dbChooseEnumeratedType,listViewOptionCheckboxes|listViewOptionMultiselect, 500,ienumCount, arrayAttrTypeChoices) //This is not working, nothing appears in the list
        //dbeAddEnumeratedChoice = choice(dbChooseEnumeratedType,"Which Type do you want to filter by? ",arrayAttrTypeChoices,0) //works for user to choose single type but need to be able to choose multiple types ie checkboxes
        dbeOKEnumerated = ok(dbChooseEnumeratedType,"OK",doEnumerateOK)
        block dbChooseEnumeratedType //this shows the dialog box then continues with the dxl

//}

print "Links will be created for " sObjectType "s that are " sEnumeratedType "s\n"


 


dnmel0 - Mon Mar 09 22:31:59 EDT 2015

Re: listView in Dialog Box blank
woodpryan - Mon Mar 09 23:42:50 EDT 2015

You'll need to realize your DBE box before you call block, then add a column to the list view. Use the function insertColumn.

It's parameters are insertColumn(DB ListView, int index, string nameOfColumn, int maxRowsOfData, iconType). Just use iconNone. You can find this function in the DXL reference manual.

Finally, you're going to need to call set(DB ListView, nameOfFunctionThatHandlesCheckBoxSelectedEvent, nameOfFunctionThatHandlesCheckBoxDeselectEvent, nameOfFunctionThatHandlesElementActivatedEvent)

You'll need to write some event handler functions for those.

Regard

woodPryan

Re: listView in Dialog Box blank
dnmel0 - Tue Mar 10 02:08:03 EDT 2015

woodpryan - Mon Mar 09 23:42:50 EDT 2015

You'll need to realize your DBE box before you call block, then add a column to the list view. Use the function insertColumn.

It's parameters are insertColumn(DB ListView, int index, string nameOfColumn, int maxRowsOfData, iconType). Just use iconNone. You can find this function in the DXL reference manual.

Finally, you're going to need to call set(DB ListView, nameOfFunctionThatHandlesCheckBoxSelectedEvent, nameOfFunctionThatHandlesCheckBoxDeselectEvent, nameOfFunctionThatHandlesElementActivatedEvent)

You'll need to write some event handler functions for those.

Regard

woodPryan

Thanks @woodPryan I've changed lines 125 to 129 to the below text, as per your suggestions and it works:

    dbChooseEnumeratedType = create("Choose Type to Filter which objects will have links")
        dbeAddEnumeratedChoice = listView(dbChooseEnumeratedType,listViewOptionCheckboxes|listViewOptionMultiselect, 500,ienumCount, arrayAttrTypeChoices) 
        //dbeAddEnumeratedChoice = choice(dbChooseEnumeratedType,"Which Type do you want to filter by? ",arrayAttrTypeChoices,0) //works for user to choose single type but need to be able to choose multiple types ie checkboxes
        dbeOKEnumerated = ok(dbChooseEnumeratedType,"OK",doEnumerateOK)
        realize dbChooseEnumeratedType
        insertColumn(dbeAddEnumeratedChoice,0,"Selection",400,iconUser) //after realizing the DB add a column to the DBE for user to select from
        block dbChooseEnumeratedType //this shows the dialog box then continues with the dxl

 

Re: listView in Dialog Box blank
woodpryan - Tue Mar 10 19:06:51 EDT 2015

No problem dnmel0. Would you mind marking this question as answered, please?